#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int v = 0, ret = 0;
        while (left < right)
        {
            v = min(height[left], height[right]) * (right - left);
            ret = max(ret, v);
            if (height[left] > height[right]) right--;
            else left++;
        }
        return ret;
    }
};